<template>
  <div class="warp-header">
    <div class="padding-left"></div>
    <div class="warp-img">
      <img
        class="log_style"
        :src="require('../assets/img/Flogo.png')"
        style="position: absolute; top: 6%; left: 10%"
      />
    </div>
    <div class="padding-center"></div>
    <div class="warp-center">
      <ul class="df flex-center">
        <li class="hover-li active-line">
          <router-link to="/home">
            <i class="el-icon-s-home"></i>
            <a class="list-block"> Home </a>
          </router-link>
        </li>
        <li class="hover-li active-line">
          <router-link to="">
            <i class="el-icon-data-analysis"></i>
            <el-dropdown
              class="list-block"
              placement="bottom-start"
              @command="handleCommand"
            >
              <span class="el-dropdown-link">
                <a class="list-block"> Data Analysis </a>
              </span>
              <template #dropdown>
                <el-dropdown-menu style="font-weight: 600">
                  <el-dropdown-item
                    class="clearfix"
                    command="/dataAnalysis/resultAnalysis"
                  >
                    <span style="font-size: 15px; padding: 3px 0px"
                      >Result Analysis</span
                    >
                    <el-badge class="mark" />
                  </el-dropdown-item>
                  <el-dropdown-item
                    class="clearfix"
                    command="/dataAnalysis/questionnaireAnalysis"
                  >
                    <span style="font-size: 15px; padding: 3px 0px"
                      >Questionnaire Analysis</span
                    >
                    <el-badge class="mark" />
                  </el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>
          </router-link>
        </li>
        <li class="hover-li active-line">
          <router-link to="">
            <i class="el-icon-s-operation"></i>
            <el-dropdown
              class="list-block"
              placement="bottom-start"
              @command="handleCommand"
            >
              <span class="el-dropdown-link">
                <a class="list-block"> Questionnaires Management </a>
              </span>
              <template #dropdown>
                <el-dropdown-menu style="font-weight: 600">
                  <el-dropdown-item
                    class="clearfix"
                    command="/questionnaireManagement/questionnaireDatabase"
                  >
                    <span style="font-size: 15px; padding: 3px 0px"
                      >Questionnaires Database</span
                    >
                    <el-badge class="mark" />
                  </el-dropdown-item>

                  <el-dropdown-item
                    class="clearfix"
                    command="/questionnaireManagement/questionnaireReview"
                  >
                    <span style="font-size: 15px; padding: 3px 0px"
                      >Questionnaires Review</span
                    >
                    <el-badge class="mark" />
                  </el-dropdown-item>
                  <el-dropdown-item
                    class="clearfix"
                    command="/questionnaireManagement/personalQuestionnaires"
                  >
                    <span style="font-size: 15px; padding: 3px 0px"
                      >Personal Questionnaires</span
                    >
                    <el-badge class="mark" />
                  </el-dropdown-item>
                  <el-dropdown-item
                    class="clearfix"
                    command="/questionnaireManagement/newQuestionnaire"
                  >
                    <span style="font-size: 15px; padding: 3px 0px"
                      >New Questionnaire</span
                    >
                    <el-badge class="mark" />
                  </el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>
          </router-link>
        </li>
        <li class="hover-li active-line">
          <router-link to="">
            <i class="el-icon-setting"></i>
            <el-dropdown
              class="list-block"
              placement="bottom-start"
              @command="handleCommand"
            >
              <span class="el-dropdown-link">
                <a class="list-block"> System Management </a>
              </span>
              <template #dropdown>
                <el-dropdown-menu style="font-weight: 600">
                  <el-dropdown-item
                    class="clearfix"
                    command="/systemManagement/userManagement"
                  >
                    <span style="font-size: 15px; padding: 3px 0px"
                      >User Management</span
                    >
                    <el-badge class="mark" />
                  </el-dropdown-item>
                  <el-dropdown-item
                    class="clearfix"
                    command="/systemManagement/dataDictionary"
                  >
                    <span style="font-size: 15px; padding: 3px 0px"
                      >Data Dictionary</span
                    >
                    <el-badge class="mark" />
                  </el-dropdown-item>
                  <el-dropdown-item
                    class="clearfix"
                    command="/systemManagement/roleManagement"
                  >
                    <span style="font-size: 15px; padding: 3px 0px"
                      >Role Management</span
                    >
                    <el-badge class="mark" />
                  </el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>
          </router-link>
        </li>
      </ul>
      <span>
        <div class="header_icon1">
          <img :src="require('../assets/img/icon01.png')" alt="" />
          <div style="width: 200px">
            <li style="color: black; font-size: 14px">Total questionnaires</li>
            <li style="color: black; font-size: 20px; margin-top: 5px">
              54,962
            </li>
          </div>
        </div>
        <div class="header_icon2">
          <img :src="require('../assets/img/icon02.png')" alt="" />
          <div style="width: 200px">
            <li style="color: black; font-size: 14px">Total users</li>
            <li style="color: black; font-size: 20px; margin-top: 5px">
              61,758
            </li>
          </div>
        </div>
        <div class="header_icon3">
          <img :src="require('../assets/img/icon03.png')" alt="" />
          <div style="width: 200px">
            <li style="color: black; font-size: 14px">Total high-risk</li>
            <li style="color: black; font-size: 20px; margin-top: 5px">
              92,109
            </li>
          </div>
        </div>
      </span>
    </div>
    <div class="spacer"></div>

    <div class="right-header">
      <div style="width: 250px">
        <span class="p_style">Welcome, Luo</span>
        <el-dropdown class="list-block" trigger="click">
          <span class="el-dropdown-link">
            <el-button type="text">
              <i class="el-icon-arrow-down el-icon--right"></i>
            </el-button>
          </span>
          <template #dropdown>
            <el-dropdown-menu style="width: 170px; font-weight: 600">
              <el-dropdown-item class="clearfix">
                <span style="font-size: 15px; padding: 3px 0px">
                  <i class="el-icon-s-release"></i>
                  <router-link :to="{ path: '/' }">Logout</router-link>
                </span>
                <el-badge class="mark" />
              </el-dropdown-item>
              <el-dropdown-item class="clearfix">
                <span
                  style="font-size: 15px; padding: 3px 0px"
                  @click="updatePwd.show = true"
                  ><i class="el-icon-s-tools"></i>Update Pwd</span
                >
                <el-badge class="mark" />
              </el-dropdown-item>
              <el-dropdown-item class="clearfix">
                <span
                  style="font-size: 15px; padding: 3px 0px"
                  @click="getInformation()"
                  ><i class="el-icon-s-tools"></i>Information</span
                >
                <el-badge class="mark" />
              </el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
      </div>
    </div>

    <el-dialog
      title="Change Password"
      :visible.sync="updatePwd.show"
      :append-to-body="true"
      width="30%"
    >
      <el-form
        :model="updatePwd"
        ref="updatePwd"
        label-position="right"
        label-width="180px"
        class="demo-registerForm"
        hide-required-asterisk
        status-icon
      >
        <el-form-item label="Phone:" prop="phone" class="labelSize">
          <el-input
            v-model="updatePwd.phone"
            placeholder="user phone"
            disabled
            size="large"
          >
          </el-input>
        </el-form-item>
        <el-form-item label="Password:" prop="password" class="labelSize">
          <el-input
            v-model="updatePwd.password"
            :type="flag ? 'text' : 'password'"
            placeholder="user password"
            size="large"
          >
            <i
              slot="suffix"
              :class="[flag ? 'el-icon-minus' : 'el-icon-view']"
              autocomplete="auto"
              @click="flag = !flag"
            />
          </el-input>
        </el-form-item>
        <el-form-item
          label="CheckPassword:"
          prop="checkPassword"
          class="labelSize"
        >
          <el-input
            v-model="updatePwd.checkPassword"
            :type="flagCheck ? 'text' : 'password'"
            placeholder="check user password"
            size="large"
          >
            <i
              slot="suffix"
              :class="[flagCheck ? 'el-icon-minus' : 'el-icon-view']"
              autocomplete="auto"
              @click="flagCheck = !flagCheck"
            />
          </el-input>
        </el-form-item>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button @click="updatePwd.show = false">cancel</el-button>
        <el-button type="primary" @click="updatePwd.show = false"
          >confirm</el-button
        >
      </div>
    </el-dialog>

    <div class="padding-right"></div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      flag: false,
      flagCheck: false,
      updatePwd: {
        show: false,
        phone: "",
        password: "",
        checkPassword: "",
      },
    };
  },
  mounted() {
    this.removePasswordInit;
  },
  methods: {
    //修改密码的回显
    removePasswordInit() {
      this.updatePwd.phone = this.$route.params.phone;
      this.updatePwd.password = this.$route.params.password;
    },
    handleCommand(command) {
      console.log(command);
      this.$router.push(command);
    },
    getInformation() {
      this.$router.push("/systemManagement/personalInformation");
    },
  },
};
</script>

<style>
</style>

<style lang="less" scoped>
.warp-header {
  position: sticky;
  top: 0;
  z-index: 201;
  width: 100%;
  display: flex;
  height: 180px;
  align-items: baseline;
  background-image: url("../assets/img/banner.jpg");
  & .padding-left {
    width: 6%;
  }
  & .warp-img {
    display: flex;
    align-items: center;
    width: 100px;
    height: 50px;
  }
  & .padding-center {
    width: 12px;
  }
  & .warp-center {
    /*display: flex;*/
    /*align-items: center;*/
    width: 71%;
    position: relative;
    top: -1px;
    left: 50px;
    & .flex-center li {
      margin-left: 30px;
      & .list-block {
        display: inline-block;
        color: rgb(24, 23, 23);
        font-weight: 600;
        font-size: 20px;
      }
    }
    & .hover-li {
      display: inline;
      &:hover {
        .list-block {
          text-decoration: underline;
          text-underline-offset: 3px;
        }
      }
    }
  }
  & .spacer {
    -webkit-box-flex: 1 !important;
    -ms-flex-positive: 1 !important;
    flex-grow: 1 !important;
  }
  & .right-header {
    position: relative;
    top: -3px;
    text-align: end;
    img {
      width: 45px;
      height: 45px;
      border-radius: 50%;
      margin-right: 20px;
    }
    & .el-tooltip__trigger {
      color: #ffffff;
      font-weight: 500;
      font-size: 16px;
    }
  }
  & .padding-right {
    width: 105px;
  }
}
.p_style {
  color: rgb(0, 0, 0);
  font-size: 18px;
  padding-right: 10px;
  font-weight: 600;
}

.header_icon1 {
  display: flex;
  position: fixed;
  top: 105px;
  left: 16%;
  z-index: 999;
}
.header_icon2 {
  display: flex;
  position: fixed;
  top: 105px;
  left: 45%;
  z-index: 999;
}
.header_icon3 {
  display: flex;
  position: fixed;
  top: 105px;
  left: 75%;
  z-index: 999;
}
</style>